//
//  PBMyMessageCell.m
//  PBHomeDemo
//
//  Created by Playboy on 2018/5/8.
//  Copyright © 2018年 tmkj. All rights reserved.
//

#import "PBMyMessageCell.h"

@interface PBMyMessageCell ()
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *desLabel;


@end

@implementation PBMyMessageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)refreshWithModel:(PBMyMessageModel *)model {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"YYYY-MM-dd hh:MM:ss";
    // 数字时间戳转化为日期，如果为13位，则需要除以1000，或者去掉后3位
    NSDate *startDate = [NSDate dateWithTimeIntervalSince1970:[[model.insertTime substringWithRange:NSMakeRange(0, 10)] doubleValue]];
    NSString *startTime = [formatter stringFromDate:startDate];
    self.timeLabel.text = startTime;
    self.nameLabel.text = model.requestName;
    self.desLabel.text = model.content;
}

@end
